<?php
class LoginAction extends Action{
	
	function init(){}
	
	function cmdIndex(){
		$returl=isset($_REQUEST['returl'])?$_REQUEST['returl']:enUrl(PATH."/index.php");
		$this->assign('returl', $returl);
		$this->assign('title', L("MEMBER_LOGIN"));
		$this->display("user/login.htm");
	}

	/**
	 * 网页登陆
	 * Enter description here ...
	 */
	function cmdLoginc(){
			$returl=isset($_REQUEST['returl'])?$_REQUEST['returl']:enUrl(PATH.'/index.php');
			$user=Model('User');
			@$username=isset($_POST['username'])?trim($_POST['username']):null;
			@$passname=isset($_POST['password'])?trim($_POST['password']):null;
			
			$type=1;
			$re=$user->Login($username, $passname);
			if($re=='登录成功'){
				$this->Message(L("CLS"),L('LOGIN_SUCCESS'),deUrl($returl),3);
			}
			else	
			  	$this->Message($re,'Message',str_replace('loginc', 'Index', getUrl(false)),3);
		}
	/**
	 * 网页退出
	 * Enter description here ...
	 */
	function cmdLogout(){
		$user=Model('User');
		$user->Logout();
		$this->Message(L("SUCCESS_EXIT"),L('EXIT'),PATH."/index.php",3);
	}

}